<template>
  <ele-modal
    :width="950"
    :visible="visible"
    :confirm-loading="loading"
    :title="'审核拒绝'"
    :body-style="{ paddingBottom: '8px' }"
    @update:visible="updateVisible"
    @ok="save"
  >
    <a-form
      :label-col="{ md: { span: 5 }, sm: { span: 4 }, xs: { span: 24 } }"
      :wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
    >
      <a-row :gutter="24">
        <a-col :md="24" :sm="24" :xs="24">
          <a-form-item label="审核结果" :colon="false">
            <span>拒绝</span>
          </a-form-item>
          <a-form-item label="备注" :colon="false">
            <a-textarea
              placeholder="请输入"
              v-model:value="form.reject_cause"
            />
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
  </ele-modal>
</template>

<script setup>
  import { ref, reactive, onMounted } from 'vue';
  import { Form, message } from 'ant-design-vue';
  // 表格列配置
  const useForm = Form.useForm;

  const emit = defineEmits(['done', 'update:visible']);

  const props = defineProps({
    // 弹窗是否打开
    visible: Boolean,
    editData: Object
  });

  // 提交状态
  const loading = ref(false);

  // 表单数据
  const form = reactive({
    order_sn: props.editData.order_sn,
    status: 3,
    real_amount: '',
    pay_type: null,
    pay_time: '',
    reject_cause: ''
  });

  // 表单验证规则
  const rules = reactive({});

  const { validate, validateInfos } = useForm(form, rules);

  /* 保存*/
  const save = () => {
    validate()
      .then(() => {
        emit('done', form);
      })
      .catch(() => {});
  };
  /* 更新visible */
  const updateVisible = (value) => {
    emit('update:visible', value);
  };
</script>
<style scoped></style>
